<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<title>FLDCMS后台管理系统</title>
<meta name="keywords" content="FLDCMS，FLDCMS后台管理系统">
<meta name="description" content="FLDCMS，是一款由FLD开发的轻量级扁平化网站后台模板，适合中小型CMS后台系统。">
{include file="public/header" /}
<style>
	img[nc_type="flex"]{cursor:pointer;}
</style>
</head>
<body>
<article class="page-container">
	<form action="{:url('node/edit')}" method="post" class="form form-horizontal" id="form-edit">
		<input type="hidden" id="node_id" name="node_id" value="{$vo.node_id}"/>
		<input type="hidden" name="form_submit" value="ok"/>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">父类节点：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<span class="select-box radius">
					<select name="pid" class="select">
						<option value="0">顶级节点</option>
						{foreach name="node_list" item="nvo"}
							<option value="{$nvo.node_id}"
								{if condition="$vo.pid eq $nvo['node_id']"}
							    	selected
							    {/if}
							>&nbsp;&nbsp;&nbsp;&nbsp;├{$nvo.node_title}</option>
							{notempty name="nvo.c_list"}
							{foreach name="nvo.c_list" item="cvo"}
								<option value="{$cvo.node_id}"
									{if condition="$vo.pid eq $cvo['node_id']"}
								    	selected
								    {/if}
								>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;├{$cvo.node_title}</option>
							{/foreach}
							{/notempty}
						{/foreach}
					</select>
				</span>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>节点名称：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$vo.node_title}" placeholder="" id="node_title" name="node_title">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>模块名：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$vo.node_controll}" placeholder="" id="node_controll" name="node_controll">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>方法名：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$vo.node_action}" placeholder="" id="node_action" name="node_action">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>排序：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$vo.sort}" placeholder="" id="sort" name="sort">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">状态：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<div class="skin-minimal">
				  <div class="radio-box">
				    <input type="radio" id="radio-1" name="status" value="1" 
						{if condition="$vo.status eq '1'"}
					    	checked
					    {/if}
					>
				    <label for="radio-1">启用</label>
				  </div>
				  <div class="radio-box">
				    <input type="radio" id="radio-2" name="status" value="0"
				    	{if condition="$vo.status eq '0'"}
					    	checked
					    {/if}
				    >
				    <label for="radio-2">关闭</label>
				  </div>
				</div>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">菜单或节点：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<div class="skin-minimal">
				  <div class="radio-box">
				    <input type="radio" id="radio-1" name="is_menu" value="1" 
					    {if condition="$vo.is_menu eq '1'"}
					    	checked
					    {/if}
				    >
				    <label for="radio-1">菜单</label>
				  </div>
				  <div class="radio-box">
				    <input type="radio" id="radio-2" name="is_menu" value="0"
				    	{if condition="$vo.is_menu eq '0'"}
					    	checked
					    {/if}
				    >
				    <label for="radio-2">节点</label>
				  </div>
				</div>
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
				<button class="btn btn-secondary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
				<button onClick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
			</div>
		</div>
	</form>
</article>
{include file="public/footer" /}
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	$("#form-edit").validate({
		rules:{
			node_title:{
				required:true,
				maxlength:20
			},
			node_controll:{
				required:true,
				maxlength:20
			},
			node_action:{
				required:true,
				maxlength:20
			},
			sort:{
				required:true,
				digits:true
			},
		},
		messages: {
			node_title:{
				required:'节点名称不能为空',
				maxlength:'节点名称不能大于20个字符',
			},
			node_controll:{
				required:'模块名不能为空',
				maxlength:'模块名不能大于20个字符',
			},
			node_action:{
				required:'方法名不能为空',
				maxlength:'方法名不能大于20个字符',
			},
			sort:{
				required:'排序不能为空',
				digits:'排序必须为数字',
			},
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			$(form).ajaxSubmit({
                dataType:"json",
                success:function(data){
                   if(data.error == 0){
                	   	layer.msg(data.msg, {icon: 1,time: 1000}, function(){
                	   		var index = parent.layer.getFrameIndex(window.name);
                			parent.location.reload();
               				parent.layer.close(index);
                		});
                   }else{
                	   layer.msg(data.msg,{icon:2,time:1000});
                   }
                }
            });
		}
	});
});

</script>
</body>
</html>